]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
gtk-embed: ensure we only listen for window-created events once
authorRay Strode <rstrode@redhat.com>
Thu, 14 Sep 2017 18:46:13 +0000 (14:46 -0400)
committerRay Strode <rstrode@redhat.com>
Fri, 15 Sep 2017 19:32:46 +0000 (15:32 -0400)
If a tray icon gets a mapped and unmapped and the mapped again
in quick succession, we can end up with multiple handlers
listening for window creation events.

This commit tries to guard against that by only listening for
window-created events when we don't  know the actor associated
with the icon.

https://bugzilla.gnome.org/show_bug.cgi?id=787361

src/shell-gtk-embed.c

index 176b4132054c02c5b59df0da75f801e30c87e552..54061046b44b8512935a765690270e1d1b4fbaa6 100644 (file)
@@ -124,13 +124,14 @@ shell_gtk_embed_on_window_mapped (GtkWidget     *object,
   ShellGtkEmbedPrivate *priv = shell_gtk_embed_get_instance_private (embed);
   MetaDisplay *display = shell_global_get_display (shell_global_get ());
 
-  /* Listen for new windows so we can detect when Mutter has
-     created a MutterWindow for this window */
-  priv->window_created_handler =
-    g_signal_connect (display,
-                      "window-created",
-                      G_CALLBACK (shell_gtk_embed_window_created_cb),
-                      embed);
+  if (priv->window_created_handler == 0 && priv->window_actor == NULL)
+    /* Listen for new windows so we can detect when Mutter has
+       created a MutterWindow for this window */
+    priv->window_created_handler =
+      g_signal_connect (display,
+                        "window-created",
+                        G_CALLBACK (shell_gtk_embed_window_created_cb),
+                        embed);
 }
 
 static void